package lanqiao;

import java.util.Scanner;

/**
 * Basic15 字符串对比
 * http://lx.lanqiao.cn/problem.page?gpid=T56
 */
public class Basic15 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str1 = scanner.next();
        String str2 = scanner.next();
        System.out.println(funConversion(str1 , str2));
    }
    public static int funConversion(String str1 , String str2) {
        if (str1.equals(str2)) {
            return 2;
        } else if (str1.length() != str2.length()) {
            return 1;
        } else if (str1.length() == str2.length()) {
            char[] charArray1 = str1.toCharArray();
            char[] charArray2 = str2.toCharArray();
            for (int i = 0; i < str1.length(); i++) {
                if (charArray1[i] != charArray2[i] + 32 && charArray1[i] + 32 != charArray2[i] && charArray1[i] != charArray2[i]) {
                    return 4;
                }
            }
        }
        return 3;
    }
}
